package com.accloud.cloudservice;

import com.accloud.common.ACSignature;
import com.google.gson.Gson;
import java.util.HashMap;
import java.util.Map;

/* access modifiers changed from: package-private */
public class SocketRequest {
    static final int INIT_SEQUENCE = 0;
    static final int INVALID_SEQUENCE = -1;
    private static final String VERSION = "1.2.0";
    private transient BaseCallback callback;
    private Map<String, Object> header = new HashMap();
    private Object payload;

    SocketRequest(String name) {
        this.header.put("X-Zc-Msg-Name", name);
        this.header.put("X-Zc-Version", VERSION);
        this.header.put("X-Zc-Major-Domain", AC.majorDomain);
        this.header.put("Content-Type", "text/json");
        setSeqId(-1);
    }

    /* access modifiers changed from: package-private */
    public void setSeqId(int seqId) {
        this.header.put("X-Zc-Seq-Id", Integer.valueOf(seqId));
    }

    /* access modifiers changed from: package-private */
    public void setSubDomain(String subDomain) {
        this.header.put("X-Zc-Sub-Domain", subDomain);
    }

    /* access modifiers changed from: package-private */
    public void setSignature(long userId, ACSignature signature) {
        this.header.put("X-Zc-User-Id", Long.valueOf(userId));
        this.header.put("X-Zc-Timestamp", Long.valueOf(signature.getTimestamp()));
        this.header.put("X-Zc-Timeout", Long.valueOf(signature.getTimeout()));
        this.header.put("X-Zc-Nonce", signature.getNonce());
        this.header.put("X-Zc-User-Signature", signature.getSignature());
    }

    /* access modifiers changed from: package-private */
    public void setPayload(Object payload2) {
        this.payload = payload2;
    }

    /* access modifiers changed from: package-private */
    public void setCallback(BaseCallback callback2) {
        this.callback = callback2;
    }

    /* access modifiers changed from: package-private */
    public BaseCallback getCallback() {
        return this.callback;
    }

    /* access modifiers changed from: package-private */
    public String toJson() {
        return new Gson().toJson(this);
    }
}
